<div class="header" id="header">
    <div class="central">
        <div class="logo">
            <a href="http://www.huicms.cn" title="HuiCms">HuiCms</a>
        </div>
        <ul class="nav">
            <volist name="nav" id="nv">
                <li>
                <!--<li class="current">-->
                    <a href="{$nv.url}" <if condition="$i eq '1'">class="current"<else />class="menu-item"</if> target="{$nv.target}">{$nv.name}</a>
                </li>
            </volist>
        </ul>
        <ul class="header-menu">
            <li class="menu-profile">
                <if condition="$Think.session.userinfo.nickname eq ''">
                    <a class="btn btn-arrow btn-headermenu" href="javascript:;">用户登陆<i class="arrow"></i></a>
                    <span class="popup-arrow" style="display: none;"><i></i></span>
                    <div class="popup-layer" style="display: none;">
                        <div class="popup">
                            <form class="popup-signin" name="loginform" id="loginform" action="#" method="post">
                                <h4 class="m_name">用户名：</h4>
                                <input class="ipt" type="text" name="user" id="user" value="" size="20">
                                <h4>密码：</h4>
                                <input class="ipt" type="password" name="passwd" id="passwd" value="" size="20">
                                <input class="btn btn-primary" type="submit" name="submit" value="立即登录">
                                <p>
                                    <a class="btn btn-mini" href='{:U("User/Register")}'>注册</a>
                                    <a class="btn btn-mini" href='{:U("User/getPassword")}'>找回密码</a>
                                </p>
                            </form>
                        </div>
                    </div>
                <else />
                <a href='{:U("Ucenter/Index/index")}' target="_blank"><img src="{$Think.session.userinfo.figureurl|default='__PUBLIC__/Home/images/default_avatar.jpg'}" title="{$Think.session.userinfo.nickname}" width="28" height="28" /></a><a href="{:U('Home/Oauth/OtherLoginOut')}" style="position: relative;top: -10px;margin-left: 5px;color: #fff;height: 28px;line-height: 28px;vertical-align: middle;">退出</a>
                </if>
                
            </li>
        </ul>
        <notempty name="oauth">
            <div class="login">
                <volist name="oauth" id="oh">
                    <a href='{:U("Home/Oauth/OtherLogin","t=$oh[type]")}' class="login_icon" title="{$oh.name}">
                        <img src="__PUBLIC__/Home/images/icon_{$oh.type}.png"/>
                    </a>
                </volist>
            </div>
        </notempty>
        
        <form method="get" class="search-form" action="/"<empty name="oauth">style="margin-right:5px;"</empty>>
            <input class="search-input" name="s" type="text" placeholder="输入关键字搜索" autofocus="" x-webkit-speech=""><input class="btn btn-primary search-submit" type="submit" value="搜索">
        </form>
        
    </div>
</div>
<div class="focus">
	<div class="central">
		<div class="toptip">
            <strong>最新消息：</strong>
        </div>
	</div>
    <div id="s1" class="scrollDiv">
        <ul>
            <volist name="announce" id="ace">
                <li><a href='{:U("Annouuce/View","id=$ace[id]")}'>{$ace.title}</a></li>
            </volist>
        </ul>
    </div>
    <div style="float: right;position: relative;top: -20px;left: -165px;">
        <wb:follow-button uid="1884369172" type="red_2" width="136" height="24" ></wb:follow-button>
       
    </div>
    <div style="float: right;position: relative;top: -20px;left: -115px;">        
        <iframe src="http://follow.v.t.qq.com/index.php?c=follow&a=quick&name=php200&style=5&t=1369761250151&f=1" frameborder="0" scrolling="auto" width="178" height="24" marginwidth="0" marginheight="0" allowtransparency="true"></iframe>
    </div>
</div>
<script type="text/javascript">
	function AutoScroll(obj){
		$(obj).find("ul:first").animate({
			marginTop:"-25px"
		},500,function(){
			$(this).css({marginTop:"0px"}).find("li:first").appendTo(this);
		});
	}
	$(document).ready(function(){
		setInterval('AutoScroll("#s1")',3000);
	});
</script>
<script>
    $(".btn-headermenu").click(function(){
        var arrow = $(".popup-arrow").css("display");
        var layer = $(".popup-layer").css("display");
        if(arrow == 'none' && layer == 'none'){
            $(".popup-arrow").show();
            $(".popup-layer").show();
        }else{
            $(".popup-arrow").hide();
            $(".popup-layer").hide();
        }  
    });    
    $(document).ready(function(){
        $("#loginform").submit(function(){
            login();
            return false;
        });
    });
    
    function login(){
        var user = $("#user").val();
        var passwd = $("#passwd").val();
        if(user==""){
            $('<span id="login_msg" />').addClass("loginError").html("用户名不能为空").appendTo('.m_name').fadeOut(2000);
            $("#user").focus();
            return false;
        }
        if(passwd==""){
            $('<span id="login_msg" />').addClass("loginError").html("密码不能为空").appendTo('.m_name').fadeOut(2000);
            $("#passwd").focus();
            return false;
        }
        var data = $("#loginform").serialize();
        $.ajax({
            url:"{:U('User/doLogin')}",
            cache:false,
            dataType:'json',
            type:'POST',
            data:data,
            error:function(){
                $('<span id="login_msg" />').addClass("loginError").html("AJAX请求发生错误").appendTo('.login').fadeOut(3000); 
            },
            success:function(msgObj){
                if(msgObj.status == '1'){
                    $('<span id="login_msg" />').addClass("loginSucc").html("登录成功").appendTo('.m_name').fadeOut(2000);
                    setTimeout(function(){
                                window.location.href="/";
                            },1500);
                    return false;
                }else{
                    $('<span id="login_msg" />').addClass("loginError").html(msgObj.info).appendTo('.m_name').fadeOut(3000); 
                    return false;
                }
            }
        });
    }
</script>